home *** CD-ROM | disk | FTP | other *** search
/ NeXT Education Software Sampler 1992 Fall / NeXT Education Software Sampler 1992 Fall.iso / Programming / Source / HippoDraw / HippoDrawSrc1.1 / Hippo.subproj / PageMarker.m < prev    next >
Encoding:
Text File  |  1992-04-25  |  1.3 KB  |  66 lines

  1. /* PageMarker.m        by Paul Rensinng    November 1991
  2.  * draws page boundary in drawing document
  3.  *
  4.  * Copyright (C)  1991  The Board of Trustees of
  5.  * The Leland Stanford Junior University.  All Rights Reserved.
  6.  */
  7.  
  8. #import "PageMarker.h"
  9.  
  10. const char PageMarker_h_rcsid[] = PAGEMARKER_H_ID;
  11. const char PageMarker_m_rcsid[] = "$Id: PageMarker.m,v 1.2 1992/03/01 12:06:23 pfkeb Rel $";
  12.  
  13. #import "HGraphicView.h"
  14. #import <appkit/View.h>        /* for NXDrawingStatus */
  15. #import <math.h>
  16.  
  17. @implementation PageMarker : Line
  18. /*
  19.  * The line to mark a page boundary.
  20.  * We must override a number of methods so that it does not print and
  21.  * so it does not move around.
  22.  */
  23.  
  24. - addSelf: (id) hgraphview
  25. {
  26.      NXRect box;
  27.      float x;
  28.  
  29.      [ hgraphview getFrame: &box ];
  30.     
  31.      box.origin.x = 0;
  32.      box.origin.y = box.size.height;
  33.      box.size.height = 0.0;
  34.      [ self setBounds: &box];
  35.      x = 0.5;
  36.      [ self setGray: &x ];
  37.      x = 4.0;
  38.      [ self setLineWidth: &x ];
  39.      [ self lock ];
  40.  
  41.      [ hgraphview insertGraphicNoSelect: self ];
  42.      
  43.      return self;
  44. }
  45.  
  46.  
  47.  
  48.      
  49. - draw
  50. /*
  51.  * Only draw if drawing on screen.
  52.  */
  53. {
  54.     if (bounds.size.width < 1.0 && bounds.size.height < 1.0) return self;
  55.     if (NXDrawingStatus == NX_DRAWING)
  56.     {
  57.      [self setLineColor];
  58.      [self drawLine];
  59.     }
  60.  
  61.     return self;
  62. }
  63.  
  64. @end
  65.  
  66.